package com.qk.management.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qk.domain.clue.ClueCountDO;
import com.qk.domain.clue.ClueDO;
import com.qk.dto.club.CluePageDTO;
import com.qk.dto.club.CluePoolPageDTO;
import com.qk.entity.Clue;
import com.qk.vo.clue.CluePoolVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ClueMapper extends BaseMapper<Clue> {

    Page<ClueDO> selectPageList(Page<ClueDO> clueDOPage, CluePageDTO dto);

    Page<CluePoolVO> selectCluePoolPageList(Page<Object> objectPage, CluePoolPageDTO dto);

    ClueCountDO selectCountClue();
    @Update("<script>" +
            "update clue set user_id = null, status = #{status}, update_time = #{updateTime} where id in " +
            "<foreach collection='ids' item='id' open='(' separator=',' close=')'>" +
            "#{id}" +
            "</foreach>" +
            "</script>")
    void updateByUserIds(@Param("ids") List<Integer> ids,
                        @Param("updateTime") LocalDateTime updateTime,
                        @Param("status") Integer status);
}
